from .yacs import CfgNode

cfg = CfgNode(new_allowed=True)
cfg.save_dir = './'
# common params for NETWORK
cfg.model = CfgNode()
cfg.model.detector = CfgNode(new_allowed=True)
cfg.model.detector.backbone = CfgNode(new_allowed=True)
cfg.model.detector.neck = CfgNode(new_allowed=True)
cfg.model.detector.head = CfgNode(new_allowed=True)

# DATASET related params
cfg.data = CfgNode(new_allowed=True)
cfg.data.train = CfgNode(new_allowed=True)
cfg.data.val = CfgNode(new_allowed=True)
cfg.device = CfgNode(new_allowed=True)
# train
cfg.schedule = CfgNode(new_allowed=True)

# logger
cfg.log = CfgNode()
cfg.log.interval = 50

# testing
cfg.test = CfgNode()
# size of images for each device


def load_config(cfg, args_cfg):
    cfg.defrost()
    cfg.merge_from_file(args_cfg)
    cfg.freeze()


if __name__ == '__main__':
    import sys
    #Sys.argv[ ]其实就是一个列表，里边的项为用户输入的参数，关键就是要明白这
    # 参数是从程序外部输入的，而非代码本身的什么地方，要想看到它的效果就应该将程序保存了，从外部来运行程序并给出参数。
    #https://www.cnblogs.com/aland-1415/p/6613449.html
    with open(sys.argv[1], 'w') as f:
        print(cfg, file=f)
